using System;
using System.Collections.Generic;

namespace SY.WebSite.Entity
{
	/// <summary>
	///	
	/// </summary>
	[Serializable]
	public class Lottery : IEntity
	{
		public const string RESERVE_CONST = "Lottery";
			
		#region Private Members
		private int _id; 
		private string _title; 
		private string _content; 
		private string _image; 
		private int _userId; 
		private string _userName; 
		private int _limitAmount; 
		private int _costAmount; 
		private string _participants; 
		private DateTime _openTime; 
		private string _lucky; 
		private string _forbidden; 
		private int _winnerId; 
		private string _winner; 
		private DateTime _createTime; 
		private int _status; 		
		[NonSerialized]
        private string _reserve;
		#endregion
		
		#region Default ( Empty ) Class Constuctor
		/// <summary>
		/// default constructor
		/// </summary>
		public Lottery()
		{
			_id = 0; 
			_title = null; 
			_content = null; 
			_image = null; 
			_userId = 0; 
			_userName = null; 
			_limitAmount = 0; 
			_costAmount = 0; 
			_participants = string.Empty; 
			_openTime = new DateTime();
            _lucky = string.Empty;
            _forbidden = string.Empty; 
			_winnerId = 0; 
			_winner = null; 
			_createTime = new DateTime(); 
			_status = 0; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor
		
		public Dictionary<string, object> ToDictionary()
		{
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
		
			dictionary.Add("Id",_id);
			dictionary.Add("Title",_title);
			dictionary.Add("Content",_content);
			dictionary.Add("Image",_image);
			dictionary.Add("UserId",_userId);
			dictionary.Add("UserName",_userName);
			dictionary.Add("LimitAmount",_limitAmount);
			dictionary.Add("CostAmount",_costAmount);
			dictionary.Add("Participants",_participants);
			dictionary.Add("OpenTime",_openTime);
			dictionary.Add("Lucky",_lucky);
			dictionary.Add("Forbidden",_forbidden);
			dictionary.Add("WinnerId",_winnerId);
			dictionary.Add("Winner",_winner);
			dictionary.Add("CreateTime",_createTime);
			dictionary.Add("Status",_status);
			
			dictionary.Add("Reserve",Reserve);//特殊
			return dictionary;
		}
		
		#region Public Properties
		/// <summary>
		/// 
		/// </summary>		
		public int Id
		{
			get { return _id; }
			set { _id = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Title
		{
			get { return _title; }
			set	
			{
				if( value!= null && value.Length > 200)
					throw new ArgumentOutOfRangeException(@"Invalid value for Title", value, value);
				
				_title = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Content
		{
			get { return _content; }
			set	
			{
				if( value!= null && value.Length > 1073741823)
					throw new ArgumentOutOfRangeException(@"Invalid value for Content", value, value);
				
				_content = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Image
		{
			get { return _image; }
			set	
			{
				if( value!= null && value.Length > 300)
					throw new ArgumentOutOfRangeException(@"Invalid value for Image", value, value);
				
				_image = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int UserId
		{
			get { return _userId; }
			set { _userId = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string UserName
		{
			get { return _userName; }
			set	
			{
				if( value!= null && value.Length > 16)
					throw new ArgumentOutOfRangeException(@"Invalid value for UserName", value, value);
				
				_userName = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int LimitAmount
		{
			get { return _limitAmount; }
			set { _limitAmount = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int CostAmount
		{
			get { return _costAmount; }
			set { _costAmount = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Participants
		{
			get { return _participants; }
			set	
			{
				if( value!= null && value.Length > 1073741823)
					throw new ArgumentOutOfRangeException(@"Invalid value for Participants", value, value);
				
				_participants = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime OpenTime
		{
			get { return _openTime; }
			set { _openTime = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Lucky
		{
			get { return _lucky; }
			set	
			{
				if( value!= null && value.Length > 2000)
					throw new ArgumentOutOfRangeException(@"Invalid value for Lucky", value, value);
				
				_lucky = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Forbidden
		{
			get { return _forbidden; }
			set	
			{
				if( value!= null && value.Length > 2000)
					throw new ArgumentOutOfRangeException(@"Invalid value for Forbidden", value, value);
				
				_forbidden = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int WinnerId
		{
			get { return _winnerId; }
			set { _winnerId = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Winner
		{
			get { return _winner; }
			set	
			{
				if( value!= null && value.Length > 16)
					throw new ArgumentOutOfRangeException(@"Invalid value for Winner", value, value);
				
				_winner = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime CreateTime
		{
			get { return _createTime; }
			set { _createTime = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Status
		{
			get { return _status; }
			set { _status = value; }
		}
			
		/// <summary>
        /// 保留属性
        /// </summary>
        public string Reserve
        {
            get 
            {
                if (string.IsNullOrEmpty(_reserve))
                    return RESERVE_CONST  ;

                return _reserve; 
            }
            set { _reserve = value; }
        }
		#endregion 
	}
}
